package org.example.ds;

import com.alibaba.druid.pool.DruidDataSource;
import org.omg.CORBA.PUBLIC_MEMBER;

import java.util.concurrent.atomic.AtomicInteger;

public class DataSourceUtil {
    public static DruidDataSource mysqlsource;

    public static DruidDataSource mssqlsource;

    public static DruidDataSource oraclesource;

    public static DruidDataSource dorisDataSource;

    public static DruidDataSource jobSource;

    private final static int MAX_ACTIVE = 300;

    private static AtomicInteger userCount = new AtomicInteger(0);

    static {

        mysqlsource = new DruidDataSource();
        mysqlsource.setUrl("jdbc:mysql://192.168.209.246:3306/test_flinkx?useSSL=false");
        mysqlsource.setUsername("root");
        mysqlsource.setPassword("Infra5@Gep0int");
        mysqlsource.setMaxActive(MAX_ACTIVE);
        mysqlsource.setLogAbandoned(true);
        mysqlsource.setRemoveAbandoned(true);
        mysqlsource.setRemoveAbandonedTimeout(180);

        mssqlsource = new DruidDataSource();
        mssqlsource.setUrl("jdbc:sqlserver://192.168.186.7:1433;database=epoint");
        mssqlsource.setUsername("dba_epoint");
        mssqlsource.setPassword("11111");
        mssqlsource.setMaxActive(MAX_ACTIVE);
        mssqlsource.setLogAbandoned(true);
        mssqlsource.setRemoveAbandoned(true);
        mssqlsource.setRemoveAbandonedTimeout(180);

        oraclesource = new DruidDataSource();
        oraclesource.setUrl("jdbc:oracle:thin:@192.168.186.36:1521:orcl");
        oraclesource.setUsername("epoint");
        oraclesource.setPassword("11111");
        oraclesource.setMaxActive(MAX_ACTIVE);
        oraclesource.setLogAbandoned(true);
        oraclesource.setRemoveAbandoned(true);
        oraclesource.setRemoveAbandonedTimeout(180);

        dorisDataSource = new DruidDataSource();
        dorisDataSource.setUrl("jdbc:mysql://192.168.186.66:9030/dorisdb_test?useSSL=false");
        dorisDataSource.setUsername("test_user");
        dorisDataSource.setPassword("11111");
        dorisDataSource.setMaxActive(MAX_ACTIVE);
        dorisDataSource.setLogAbandoned(true);
        dorisDataSource.setRemoveAbandoned(true);
        dorisDataSource.setRemoveAbandonedTimeout(180);

        jobSource = new DruidDataSource();
        jobSource.setUrl("jdbc:mysql://192.168.33.10:3306/?useSSL=false");
        jobSource.setUsername("root");
        jobSource.setPassword("Infra5@Gep0int");
        jobSource.setMaxActive(MAX_ACTIVE);
        dorisDataSource.setLogAbandoned(true);
        jobSource.setRemoveAbandoned(true);
        jobSource.setRemoveAbandonedTimeout(180);
    }
}
